package com.haojiu.service;

import com.github.pagehelper.PageHelper;
import com.haojiu.mapper.AdminMapper;
import com.haojiu.pojo.Admin;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author:我叫浩九
 * @date：2021/8/30 10:26
 * create in RuGao JiangSu
 */
public class AdminServiceImpl implements AdminService{

    @Autowired
    private AdminMapper adminMapper;

    public void setAdminMapper(AdminMapper adminMapper){
        this.adminMapper=adminMapper;
    }
    @Override
    public int addAdmin(Admin admin) {
        return adminMapper.addAdmin(admin);
    }

    @Override
    public Admin queryAdminByName(String adminName) {
        return adminMapper.queryAdminByName(adminName);
    }

    @Override
    public int deleteAdminByName(String adminName) {
        return adminMapper.deleteAdminByName(adminName);
    }

    @Override
    public int updateAdmin(Admin admin) {
        return adminMapper.updateAdmin(admin);
    }

    @Override
    public List<Admin> queryAllAdmin(int page, int size) {
        PageHelper.startPage(page,size);
        return adminMapper.queryAllAdmin();
    }

    @Override
    public List<Admin> queryAllAdmin() {
        return adminMapper.queryAllAdmin();
    }
}
